import os
import aiomysql
import aioredis
import sys
from redis import StrictRedis
import logging

BASE_DIRS = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, BASE_DIRS)

IMG_URL = "http://81.71.137.167:8082/content/"
LOGGING_FORMAT = '[%(levelname)s] [%(asctime)s %(filename)s %(lineno)d] %(message)s'
LOGGING_LEVEL = 'DEBUG'
logger: logging.Logger

# Application_setting
settings = {
    'debug': False,
    'cookie_secret': "jk4j3989ajfkjfiaf;aig93@$18405450j321329ufiad;fljlj",
}
# 支付方式
payment_method = {
    1: '支付宝'
}

# mysql
pool: aiomysql.Pool
MYSQL_HOST = "81.71.137.167"
MYSQL_PORT = 3306
MYSQL_USER = 'root'
MYSQL_DB = 'mall_demo02'
MYSQL_PASSWD = 'LgDk%zMG0x!lfc@C'
MYSQL_CONNECTION_MAXSIZE = 2
MYSQL_POOL_RECYCLE = 60
# redis
redis: aioredis.commands.Redis
REDIS_ADDR = "redis://81.71.137.167"
SESSION_REDIS_HOST = "81.71.137.167"
REDIS_PASSWORD='redis6379!@#$%^'
sync_redis: StrictRedis

# celery_redis
redis_broker_url = 'redis://81.71.137.167:6379/0'
REDIS_HOST = '81.71.137.167'

COOKIE_EXPIRES_DAYS = 30

SESSION_SECRET = b"ccb1f7722e52b824f70382c048693bd7799b04a664b05ba87e6b30800f1bcdc3"
SESSION_TIMEOUT = 30 * (3600 * 24)  # s //30天



# 图片前缀路径
IMG_PATH = 'http://81.71.137.167:8005/content/'

